|
Header: |
Quickdraw.h |
|
Carbon status: |
Unsupported |
Allocates space for and initializes a basic graphics port.
void OpenPort (
GrafPtr port
);
-
port
-
On return, a pointer to an initialized GrafPort structure. (You can create the pointer to this structure with the Memory Manager function NewPtr.) The OpenPort function allocates space for visible and clipping regions for this structure, initializes the fields of this structure, and makes this structure the current graphics port (by calling SetPort).
-
-
-
DISCUSSION
The Window Manager calls OpenPort for each black-and-white window it creates, and the NewGWorld function calls OpenPort for every offscreen graphics world containing a basic graphics port that it creates. You normally won’t call OpenPort yourself.
The OpenPort function initializes the fields of theGrafPort structure as follows.
- The variable device is of type Integer and has an initial setting of 0 (the screen).
- The variable portBits is of type BitMap and has an initial setting of screenBits (global variable for main screen).
- The variable portRect is of type Rect and has an initial setting of screenBits->bounds.
- The variable visRgn is of type RgnHandle and has an initial setting of the handle to a rectangular region coincident with screenBits->bounds
- The variable clipRgn is of type RgnHandle and has an initial setting of the handle to the rectangular region (–32768,–32768,32767,32767).
- The variable bkPat is of type Pattern and has an initial setting of white.
- The variable fillPat is of type Pattern and has an initial setting of black.
- The variable pnLoc is of type Point and has an initial setting of (0,0).
- The variable pnSize is of type Point and has an initial setting of (1,1).
- The variable pnMode is of type Integer and has an initial setting of the patCopy pattern mode.
- The variable pnPat is of type Pattern and has an initial setting of black.
- The variable pnVis is of type Integer and has an initial setting of 0 (visible).
- The variable txFont is of type Integer and has an initial setting of 0 (system font).
- The variable txFace is of type Style and has an initial setting of plain.
- The variable txMode is of type Integer and has an initial setting of srcOr source mode
- The variable txSize is of type Integer and has an initial setting of 0 (system font size).
- The variable spExtra is of type Fixed and has an initial setting of 0.
- The variable fgColor is of type LongInt and has an initial setting of blackColor.
- The variable bkColor is of type LongInt and has an initial setting of whiteColor.
- The variable colrBit is of type Integer and has an initial setting of 0.
- The variable patStretch is of type Integer and has an initial setting of 0.
- The variable picSave is of type Handle and has an initial setting of NULL.
- The variable rgnSave is of type Handle and has an initial setting of NULL.
- The variable polySave is of type Handle and has an initial setting of NULL.
- The variable grafProcs is of type QDProcsPtr and has an initial setting of NULL.
The OpenPort function may move or purge memory blocks in the application heap. Your application should not call this function at interrupt time.
AVAILABILITY
Not supported in Carbon. Not available in CarbonLib, but available when InterfaceLib 7.1 or later is installed. Exported by InterfaceLib 7.1 and later.
CARBON NOTES
Carbon applications should use CreateNewPort and DisposePort to open and close graphics ports.
© 2000 Apple Computer, Inc. — (Last Updated 4/14/2000)